Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 20: Lighting Your World

../ch20/20fig09.gif
Figure 20.9

A glowing sphere within a gothic building.

20fig09.wrl
Click on the image to view the VRML scene.

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
    children [
    # Vaulted ceiling and columns
        Inline {
            url "vaulted.wrl"
            bboxCenter 0.0 1.0 0.0
            bboxSize   6.0 2.0 6.0
        },
    # Floor
        Inline {
            url "mesh.wrl"
            bboxCenter 0.0 0.0 0.0
            bboxSize   15.0 0.0 15.0
        },
    # Glowing sphere
        Transform {
            translation 0.0 1.0 0.0
            children [
                PointLight {
                    location  0.0 0.0 0.0
                    radius    10.0
                    intensity 1.0
                    ambientIntensity 0.2
                    color 0.7 0.5 0.0
                },
                Shape {
                    appearance Appearance {
                        # No material, use emissive texturing
                        texture ImageTexture {
                            url "fire.jpg"
                        }
                    }
                    geometry Sphere { radius 0.2 }
                }
            ]
        },
    # Pedestal pyramid
        Shape {
            appearance DEF White Appearance {
                material Material { }
            }
            geometry IndexedFaceSet {
                coord Coordinate {
                    point [
                    # Around the base
                        -0.12 0.03  0.12,   0.12 0.03  0.12,
                         0.12 0.03 -0.12,  -0.12 0.03 -0.12,
                    # Tip
                         0.0  0.63  0.0,
                    ]
                }
                coordIndex [
                    0, 1, 4, -1,  1, 2, 4, -1,
                    2, 3, 4, -1,  3, 0, 4, -1,
                ]
                solid TRUE
            }
        },
    # Pedestal base
        Transform {
            translation 0.0 0.015 0.0
            children Shape {
                appearance USE White
                geometry Box { size 0.4 0.03 0.4 }
            }
        }
    ]
}